package codelib.spring3transaction.biz.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Component;

import codelib.spring3transaction.biz.UserService;
import codelib.spring3transaction.dao.UserDAO;
import codelib.spring3transaction.dao.model.User;

@Component("UserServiceImpl")
public class UserServiceImpl implements UserService {
	private UserDAO userDAO;

	@Override
	public void create(User user) {
		this.userDAO.create(user);
	}

	@Override
	public List<User> retrieveAll() {
		return this.userDAO.retrieveAll();
	}

	@Override
	public List<User> retrieveByName(String userName) {
		return this.userDAO.retrieveByName(userName);
	}

	@Override
	public void update(User user) {
		this.userDAO.update(user);
	}

	@Override
	public void delete(int userId) {
		this.userDAO.delete(userId);
	}

	public UserDAO getUserDAO() {
		return userDAO;
	}

	@Resource(name = "UserDAOImpl")
	public void setUserDAO(UserDAO userDAO) {
		this.userDAO = userDAO;
	}

}
